import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueDevTools from 'vite-plugin-vue-devtools'
import NodePolyfills from 'vite-plugin-node-polyfills';
import path from 'path';  

export default defineConfig({
  plugins: [
    vue(),
    vueDevTools(),
    NodePolyfills
  ],
  define: {
    'global': 'window'  // 显式将 global 定义为 window
  },
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')  
    },
  },
  optimizeDeps: {
    include: ['sockjs-client']  
  },
  base: './',
  server: {
    host: '0.0.0.0', // 允许局域网访问
    port: 5173     
  }
})
